load("@fbcode_macros//build_defs:rust_binary.bzl", "rust_binary")
load("@fbcode_macros//build_defs:rust_library.bzl", "rust_library")
load("@fbsource//tools/build_defs:glob_defs.bzl", "glob")

oncall("buck2")

rust_library(
    name = "dice",
    srcs = glob(
        ["src/**/*.rs"],
    ),
    crate_root = "src/lib.rs",
    doctests = False,  # FIXME
    test_deps = [
        "fbsource//third-party/rust:assert_matches",
        "fbsource//third-party/rust:bincode",
        "fbsource//third-party/rust:derivative",
        "fbsource//third-party/rust:tempfile",
    ],
    deps = [
        "fbsource//third-party/rust:anyhow",
        "fbsource//third-party/rust:anymap",
        "fbsource//third-party/rust:async-trait",
        "fbsource//third-party/rust:dashmap",
        "fbsource//third-party/rust:derivative",
        "fbsource//third-party/rust:derive_more",
        "fbsource//third-party/rust:fnv",
        "fbsource//third-party/rust:futures",
        "fbsource//third-party/rust:hashbrown",
        "fbsource//third-party/rust:indexmap",
        "fbsource//third-party/rust:itertools",
        "fbsource//third-party/rust:once_cell",
        "fbsource//third-party/rust:parking_lot",
        "fbsource//third-party/rust:serde",
        "fbsource//third-party/rust:slab",
        "fbsource//third-party/rust:take_mut",
        "fbsource//third-party/rust:thiserror",
        "fbsource//third-party/rust:tokio",
        "fbsource//third-party/rust:tokio-stream",
        "fbsource//third-party/rust:tracing",
        "fbsource//third-party/rust:triomphe",
        "//buck2/allocative/allocative:allocative",
        "//buck2/gazebo/dupe:dupe",
        "//buck2/gazebo/gazebo:gazebo",
        "//buck2/shed/more_futures:more_futures",
        "//common/rust/shed/sorted_vector_map:sorted_vector_map",
    ],
)

rust_binary(
    name = "read_dump",
    srcs = ["bin/read_dump.rs"],
    deps = [
        "fbsource//third-party/rust:anyhow",
        "fbsource//third-party/rust:bincode",
        "fbsource//third-party/rust:clap-3",
        "fbsource//third-party/rust:serde_json",
        ":dice",
    ],
)
